#ifndef POINT_H
#define POINT_H

#include <gmpxx.h>
#include "sign.h"
#include <limits>
#include <cmath>
#include <vector>

const double meps = 8 * std::numeric_limits<double>::epsilon();

struct point
{
    double x, y;
    point();

    point(double x_, double y_);
    bool operator == (const point& );
    bool operator != (const point& );
};

sign left_turn(const point& p1, const point& p2, const point& p3);
sign long_left_turn(const point& p1, const point& p2, const point& p3);

std::istream& operator >>(std::istream&, point&);
std::ostream& operator <<(std::ostream&, const point&);

sign in_circle(const point&, const point&, const point&, const point&);

std::vector<point> circumscribed_sircle(const std::vector<point>&);

std::vector<point> convex_hull(std::vector<point>);

double distance2(const point&, const point&);

mpq_class long_distance2(const point&, const point&);

std::pair<point, point> max_distance(const std::vector<point>&);

std::pair<point, point> max_distance_stupid(const std::vector<point>&);

struct cmp_by_x
{
        bool operator() (const point&, const point&) const;
};

struct cmp_by_angle
{
        bool operator() (const point&, const point&) const;

        cmp_by_angle();
        cmp_by_angle(const point&);

        point center;
};

struct cmp_by_distance
{
    sign operator() (const std::pair<point, point>&, const std::pair<point, point>&);
};

#endif // POINT_H
